﻿Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Imports Microsoft.SqlServer.Server
Imports FileManipulationSQLCLRExternal.SharedObjects

Partial Public Class UserDefinedFunctions
    <Microsoft.SqlServer.Server.SqlFunction()> _
    Shared Function MFFileExistsCheck(ByVal FilePath As SqlString, ByVal FileName As SqlString) As SqlByte
        Try
            Dim _bResult As Boolean = FileExistsCheck(CType(FilePath, String), CType(FileName, String))

            If _bResult = True Then
                Return New SqlByte(1)
            Else
                Return New SqlByte(0)
            End If
        Catch sqlex As SqlException
            Throw New Exception("", sqlex)
        Catch ex As Exception
            Throw New Exception("", ex)
        End Try

        Return New SqlByte(0)
    End Function
End Class
